<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCustomerRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_records', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('user_id')->unsigned()->default(0)->comment('用户ID');
            $table->bigInteger('customer_id')->unsigned()->default(0)->comment('客户ID');
            $table->tinyInteger('type')->unsigned()->default(0)->comment('跟踪方式');
            $table->tinyInteger('result')->unsigned()->default(0)->comment('跟踪结果');
            $table->text('remark')->comment('跟踪详情');
            $table->timestamps();
        });

        Schema::create('customer_records_file', function(Blueprint $table)
        {
            $table->id();
            $table->bigInteger('records_id')->unsigned()->comment('跟踪记录ID');
            $table->string('path')->default('')->comment('文件路径');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_records');
        Schema::dropIfExists('customer_records_file');
    }
}
